<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>申请审核</title>
    <link rel="stylesheet" href="/asset/layui/css/layui.css">
    <link rel="stylesheet" href="/asset/css/index.css">
    <link rel="Shortcut Icon" href="cachet.ico">
    <script type="text/javascript" src="/asset/js/jquery-3.3.1.min.js"></script>
	<script src="/asset/layui/layui.js"></script>
    <script src="/asset/js/common.js"></script>
</head>
<body >
<div class="alert_bigbox">

	<form class="layui-form">
		  <input type="hidden" id="applyType" name="applyType" value="TEST_APPLY">
		  <input type="hidden" id="devicesId" name="devicesId" value="${devices.devicesId}">
		  <input type="hidden" id="cause" name="cause" value="印章测试申请">
		  	
          <div class="layui-form-item">
              <label for="devicesId" class="layui-form-label">申请类型</label>
              <div class="layui-input-inline">
              	  <select name="quiz1">
			        <option value="">请选择申请类型</option>
			        <option value="">使用申请</option>
			        <option value="">外带申请</option>
			      </select>
              </div>
          </div>
          
          <div class="layui-form-item">
              <label for="model" class="layui-form-label">印章名称</label>
              <div class="layui-input-inline">
              	   <select name="modules" lay-verify="required" lay-search="">
			          <option value="">直接选择或搜索选择</option>
			          <option value="1">layer</option>
			          <option value="2">form</option>
			        </select>
              </div>
          </div>
          
          <div class="layui-form-item">
              <label for="model" class="layui-form-label">
                  申请次数
              </label>
              <div class="layui-input-inline" style="width:100px">
              	  <input type="text" id="applyTimes" name="applyTimes" value="1" required="" lay-verify="alias" autocomplete="off" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">每次最多可申请5次</span>
              </div>
          </div>
          
          <div class="layui-form-item">
              <label for="model" class="layui-form-label">
                  申请事由
              </label>
              <div class="layui-input-inline" style="width:100px">
              	  <textarea placeholder="申请事由" class="layui-textarea"></textarea>
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">每次最多可申请5次</span>
              </div>
          </div>
          
          <div class="layui-form-item">
              <label for="model" class="layui-form-label">相关合同</label>
              <div class="layui-input-inline" style="width:100px">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">每次最多可申请5次</span>
              </div>
          </div>
          
          
          <div class="layui-form-item">
              <label for="model" class="layui-form-label">相关合同</label>
              <div class="layui-input-inline">
              	  <input type="radio" name="sex" value="男" title="同意" checked="">
			      <input type="radio" name="sex" value="女" title="拒绝">
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">每次最多可申请5次</span>
              </div>
          </div>
          
          <div class="layui-form-item">
              <label for="model" class="layui-form-label">审核结果</label>
              <div class="layui-input-inline">
              	  <textarea placeholder="审核结果：如同意" class="layui-textarea"></textarea>
              </div>
              <div class="layui-form-mid layui-word-aux">
                  <span class="x-red">每次最多可申请5次</span>
              </div>
          </div>
          
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <button  class="layui-btn" lay-filter="add" lay-submit="">提交申请</button>
          </div>
      </form>

</div>

    <script>
        layui.use(['form','layer','laydate'], function(){
            $ = layui.jquery;
          var form = layui.form,layer = layui.layer,laydate = layui.laydate;
          
          laydate.render({
		    elem: '.dateinput' //指定元素
		  });
        
          //自定义验证规则
          form.verify({
            devicesId: function(value){
              if(value.length < 8){
                return '设备编号为8为字符';
              }
            }
            ,alias: function(value){
                if(value == null){
                    return '请输入印章名称，如“财务印章”';
                }
            }
          });

          //监听提交
          form.on('submit(add)', function(data){
            $.ajax({
      			type:"POST", 
      			url:"/apply/submit.htm",
      			data:data.field,
      			success:function(result) {
		      
		      		if(result.code=='1'){
		      			layer.alert("增加成功", {icon: 6},function () {
			                // 获得frame索引
			                 window.parent.location.reload();
			                var index = parent.layer.getFrameIndex(window.name);
			                //关闭当前frame
			                parent.layer.close(index);
			            });
		      		}else{
		      		 	layer.msg(result.msg);
		      		}
		      
		    	 	} 
		    }); 
            
            return false;
          });
          
        });
    </script>

</body>
</html>